package com.xiaoy.core.base.security.user.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;

import com.xiaoy.core.base.security.role.entity.Role;
import com.xiaoy.core.base.security.user.dao.UserDao;
import com.xiaoy.core.base.security.user.entity.User;

@Service
public class UserService {
	
//	@Resource
//	private RoleService roleService;
//	
	
	@Resource
	private UserDao userDao;
	
	public List<Role> getAllRoleByUser (String username) {
		
		
		return null;
	}
	
	public Page<User>filterPage (Page<User> page) {
		return userDao.findPage(page, page.getFilters());
	}
	
	public List<User> getUsers () {
		return userDao.getAll();
	}
	
	@Transactional
	public void save (User user) {
		userDao.save(user);
	}
	
	public User get(long id){
		return userDao.get(id);
	}
}
